<%@ page language="java" pageEncoding="UTF-8"%>

<script type="text/javascript">
var task = null;	//记录当前的任务JSON

function loadItem(){
	var id = request("id");
	if(id == undefined || id == ""){
		$.alert("错误的参数！");
		return;
	}
	
	block("#detailForm", "正在加载数据...");
	$.ajax({
		type: "GET",
		cache: false,
		url: "detail.json?id=" + id,
		dataType: "json",
		success: loadSucceedCallback,
		error:function(message){
			unblock("#detailForm");
			$.alert(message);
		}  
	});	
}

function loadSucceedCallback(data){
	unblock("#detailForm");
	if (!data.succeed) {
		$.notice(data.message);
		return;
	}
	task = data.data;
	fillItem(data.data);
}

function fillItem(item){
	$("#taskId").val(item.id);
	$("#taskExecPerson").val(item.execPersonName);
	$("#taskExecPerson").data("id", item.execPersonId);
	$("#taskExecOrgan").val(item.execOrganName);
	$("#taskExecOrgan").data("id", item.execOrganId);
	$("#taskType").val(getCheckinType(item.type));
	$("#taskDescription").val(item.description);
	$("#taskLocationAddress").val(item.locationAddress);
	$("#taskLongitude").val(item.longitude);
	$("#taskLatitude").val(item.latitude);
	$("#taskLocateDate").val(item.locateDate);
}

$(document).ready(function() {
	loadItem();
	$("#detailForm").find("input,textarea").attr("readonly", "readonly");
});
</script>

<form id="detailForm" class="form-horizontal">
<input type="hidden" id="taskId" name="taskId" />
<fieldset>
	<div class="control-group">
		<label for="taskExecPerson"  class="control-label">考勤人员：</label>
		<div class="controls">
		<input type="text" id="taskExecPerson" name="taskExecPerson" readonly="readonly" />
		</div>
	</div>
	<div class="control-group">
		<label for="taskExecOrgan"  class="control-label">所属部门：</label>
		<div class="controls">
		<input type="text" id="taskExecOrgan" name="taskExecOrgan" readonly="readonly" />
		</div>
	</div>
	<div class="control-group" id="taskStatusCg">
		<label for="taskType"  class="control-label">考勤类型：</label>
		<div class="controls">
		<input type="text" id="taskType" name="taskType" readonly="readonly" />
		</div>
	</div>
	<div class="control-group">
		<label for="taskDescription"  class="control-label">说明内容：</label>
		<div class="controls">
		<textarea id="taskDescription" name="taskDescription"></textarea>
		</div>
	</div>
	<div class="control-group" id="taskLocateDateCg">
		<label for="taskLocateDate"  class="control-label">定位时间：</label>
		<div class="controls">
		<input type="text" id="taskLocateDate" name="taskLocateDate" readonly="readonly" />
		</div>
	</div>
	<div class="control-group" id="taskLocationAddressCg">
		<label for="taskLocationAddress"  class="control-label">考勤地点：</label>
		<div class="controls">
		<input type="text" id="taskLocationAddress" name="taskLocationAddress" readonly="readonly" />
		</div>
	</div>
	<div class="control-group">
		<label for="taskLongitude"  class="control-label">经度：</label>
		<div class="controls">
		<input type="text" id="taskLongitude" name="taskLongitude" readonly="readonly" />
		</div>
	</div>
	<div class="control-group">
		<label for="taskLatitude"  class="control-label">纬度：</label>
		<div class="controls">
		<input type="text" id="taskLatitude" name="taskLatitude" readonly="readonly" />
		</div>
	</div>
</fieldset>
</form>